package com.example.maybeaccount.Mode;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** 输入合法检测 */
public class Check_ok {
    //判断输入字符是否合法
    public static boolean is_double(String temp){
        Pattern pattern = Pattern.compile("[0-9]+[.]{0,1}[0-9]*[dD]{0,1}");

        Matcher isNum = pattern.matcher(temp);

        if( !isNum.matches() ){
            return false;
        }
        double var=Double.parseDouble(temp);
        if(var>99999999)
            return false;
        return true;
    }
    //判断密码是否合法.
    public boolean password_limit(String temp) {
        int length_password=temp.length();
        String LETTER_DIGIT_REGEX = "^[a-z0-9A-Z]+$";
        if(length_password<6 || length_password>16) {
            return false;
        }
        return temp.matches(LETTER_DIGIT_REGEX);
    }
    //判断备注文本是否合法
    public static boolean remark_text(String temp) {
        int len_text=temp.length();
        if(len_text>200) {
            return false;
        }
        return true;
    }
    //判断一般文本输入是否合法
    public static boolean normal_text(String temp) {
        int len_text=temp.length();
        if(len_text>20) {
            return false;
        }
        return true;
    }
}